import React, { useState } from "react";
import { Link, useLocation } from "umi";
import { Menu } from "antd";
import "./index.less";
import Header from "../GHeader";

const Navbar: React.FC<{}> = () => {
  const location = useLocation();
  const selectedKey = location.pathname.split("/")[1] || "home"; // 获取当前路径的第一级路径，如果没有则默认为 home

  const [activeKey, setActiveKey] = useState("home");

  const handleTabClick = (key: string) => {
    setActiveKey(key);
    // 你还可以在这里添加导航逻辑，如滚动到对应区域
  };

  return <Header activeKey={activeKey} onTabClick={handleTabClick} />;
};

export default Navbar;
